package com.hospital.common.dto.auth.module;

import com.hospital.common.validator.auth.module.ValidateGroup;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserDto {
    /**
     * 账号(手机号)
     */
    @NotEmpty(message = "账号不能为空", groups = {
            ValidateGroup.UserGroup.Login.class,
            ValidateGroup.UserGroup.Register.class
    })
    @Pattern(regexp = "^\\d{11}$", message = "手机号格式错误", groups = {
            ValidateGroup.UserGroup.Login.class,
            ValidateGroup.UserGroup.Register.class
    })
    private String account;
    /**
     * 密码(6~20)
     */
    @NotEmpty(message = "密码不能为空", groups = {
            ValidateGroup.UserGroup.Register.class
            , ValidateGroup.UserGroup.Login.class
    })
    @Pattern(regexp = "^.{6,20}$", message = "密码格式错误", groups = {
            ValidateGroup.UserGroup.Register.class
            , ValidateGroup.UserGroup.Login.class
    })
    private String password;
    /**
     * 确认密码(6~20)
     */
    @NotEmpty(message = "确认密码不能为空", groups = ValidateGroup.UserGroup.Register.class)
    @Pattern(regexp = "^.{6,20}$", message = "确认密码格式错误", groups = ValidateGroup.UserGroup.Register.class)
    private String confirmPassword;
    /**
     * 用户类型(0患者,1医生,2管理员)
     */
    @NotNull(message = "用户类型不能为空", groups = {
            ValidateGroup.UserGroup.Register.class
            , ValidateGroup.UserGroup.Login.class
    })
    private Integer roleType;
    /**
     * 性别(0男,1女)
     */
    @NotNull(message = "性别不能为空", groups = ValidateGroup.UserGroup.Register.class)
    private Integer sex;
}
